#!/usr/bin/env python3.10
# -*- encoding: utf-8 -*-
'''
@File    :   middleware.py
@Time    :   2024/02/20 10:54:31
@Author  :   windstarry 
@Version :   1.0
'''
# here put the import lib
from django.utils.deprecation import MiddlewareMixin

from utils.logger import logger


class ExceptionMiddleware(MiddlewareMixin):
    def process_exception(self, request, exception):
        """
        记录所有的异常日志
        """
        logger.error(f'URL=[{request.path}], {exception}')